Skip to content

feat: improve plugin json error recovery - #30

Merged
jinbagi merged 1 commit into
masterfrom
codex/plugin-json-error-recovery
Jul 3, 2026
Merged

feat: improve plugin json error recovery#30
jinbagi merged 1 commit into
masterfrom
codex/plugin-json-error-recovery

Conversation

@jinbagi

@jinbagi jinbagi commented Jul 3, 2026

Copy link
Copy Markdown
Owner

Summary

  • move plugin JSON save errors above the editor so long configs do not hide failures below the fold
  • add Format JSON and Reset JSON recovery actions directly on plugin JSON error alerts
  • expose the Monaco editor handle in dev/test mode so E2E can reliably exercise invalid JSON recovery
  • cover invalid plugin metadata JSON recovery before saving a valid APISIX plugin metadata payload

Verification

  • .\node_modules.bin\tsc.CMD -b --pretty false
  • .\node_modules.bin\eslint.CMD src/components/form/Editor.tsx src/components/form-slice/FormItemPlugins/PluginEditorDrawer.tsx e2e/tests/plugin_metadata.crud-all-fields.spec.ts --max-warnings=0 --no-warn-ignored
  • E2E_TARGET_URL=http://127.0.0.1:55173/ui/ playwright test e2e/tests/plugin_metadata.crud-all-fields.spec.ts --config=.tmp-playwright-chrome.config.ts --project=chrome --reporter=list --workers=1
  • corepack pnpm lint
  • corepack pnpm build

Copilot AI review requested due to automatic review settings July 3, 2026 11:32
@jinbagi
jinbagi merged commit 75d9c8c into master Jul 3, 2026
1 check passed
@jinbagi
jinbagi deleted the codex/plugin-json-error-recovery branch July 3, 2026 11:32

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR improves the APISIX plugin JSON editing experience in the Dashboard by making JSON save failures easier to notice and recover from, and adds Playwright coverage for invalid JSON recovery on plugin metadata.

Changes:

  • Moves plugin JSON save error alerts above the editor and adds “Format JSON” / “Reset JSON” recovery actions directly on the error alert.
  • Exposes a global Monaco editor handle in FormItemEditor during dev/test to support E2E interaction.
  • Extends the plugin metadata CRUD E2E spec to cover invalid JSON recovery before saving a valid payload.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
src/components/form/Editor.tsx Updates Monaco onMount logic to optionally expose the editor instance on window in dev/test contexts.
src/components/form-slice/FormItemPlugins/PluginEditorDrawer.tsx Adds inline recovery actions to the JSON save error alert and repositions the alert above the editor area.
e2e/tests/plugin_metadata.crud-all-fields.spec.ts Adds a new invalid-JSON recovery flow to the plugin metadata CRUD Playwright test.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +79 to +85
await page.evaluate(() => {
window.__monacoEditor__?.getModel()?.setValue('{');
});
await page.waitForFunction(
() => window.__monacoEditor__?.getModel()?.getValue() === '{'
);
await pluginEditor.blur();
Comment on lines 184 to 187
onMount={(editor) => {
if (process.env.NODE_ENV === 'test') {
if (process.env.NODE_ENV === 'test' || import.meta.env.DEV) {
window.__monacoEditor__ = editor;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants